home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 21 / Mac Magazin and MacEasy Magazine CD - Issue 21.iso / Wissenschaft & Technik / yorick12vr1-ppc folder / include / prmtyp.i < prev    next >
Text File  |  1996-02-13  |  7KB  |  192 lines

  1. /*
  2.    PRMTYP.I
  3.    Define functions which set file primitive data type formats.
  4.  
  5.    $Id: prmtyp.i,v 1.1 1993/08/27 18:50:06 munro Exp $
  6.  */
  7. /*    Copyright (c) 1994.  The Regents of the University of California.
  8.                     All rights reserved.  */
  9.  
  10. /*--------------------------------------------------------------------------*/
  11.  
  12. /* install_struct, file, type_name,  size, alignment, order, layout
  13.      size--      size in bytes
  14.      alignment-- alignment boundary in structs in bytes
  15.      order--     1 MSB first (big-endian), -1 LSB first (little-endian)
  16.                  2 VAX floating point (middle-endian)
  17.          The sign of order determines the order of "words"
  18.          within the type; the absolute value of order is the
  19.          "word" size in bytes.
  20.      layout--    [sign_address,  exponent_address, exponent_bits,
  21.                   mantissa_address, mantissa_bits,
  22.           mantissa_normalization, exponent_bias]
  23.     These are bit addresses, assuming big-endian byte ordering
  24.     (order=1).
  25.     The mantissa_normalization is 0 unless the first bit of the
  26.     mantissa (at mantissa_address) is always set, in which case
  27.     it is 1.  In the former case, the mantissa is 1.MMMMMMM...,
  28.     in the latter case, it is M.MMMMMM..., where the first M bit
  29.     is always 1.
  30.     The number is {(-1)^S * 2^(EEEE... - exponent_bias) * mantissa},
  31.     where the mantisa is either 1.MMMM... or M.MMMM..., as above,
  32.     S is the sign bit, and EEEE... is the exponent.
  33.  */
  34.  
  35. /*--------------------------------------------------------------------------*/
  36.  
  37. func raw_sun_p(file)
  38. /* DOCUMENT raw_sun_p, file
  39.      sets FILE primitive data types to be native to Sun Sparc, HP, IBM, etc.
  40.  */
  41. {
  42.   install_struct, file, "char",    1, 1, 1;
  43.   install_struct, file, "short",   2, 2, 1;
  44.   install_struct, file, "int",     4, 4, 1;
  45.   install_struct, file, "long",    4, 4, 1;
  46.   install_struct, file, "float",   4, 4, 1, [0, 1, 8,  9,23, 0,  0x7f];
  47.   install_struct, file, "double",  8, 8, 1, [0, 1,11, 12,52, 0, 0x3ff];
  48.   struct_align, file, 1;
  49. }
  50.  
  51. func raw_sun3_p(file)
  52. /* DOCUMENT raw_sun3_p, file
  53.      sets FILE primitive data types to be native to Sun-2 or Sun-3.
  54.  */
  55. {
  56.   install_struct, file, "char",    1, 1, 1;
  57.   install_struct, file, "short",   2, 2, 1;
  58.   install_struct, file, "int",     4, 2, 1;
  59.   install_struct, file, "long",    4, 2, 1;
  60.   install_struct, file, "float",   4, 2, 1, [0, 1, 8,  9,23, 0,  0x7f];
  61.   install_struct, file, "double",  8, 2, 1, [0, 1,11, 12,52, 0, 0x3ff];
  62.   struct_align, file, 1;
  63. }
  64.  
  65. func raw_dec_p(file)
  66. /* DOCUMENT raw_dec_p, file
  67.      sets FILE primitive data types to be native to DEC (MIPS) workstations.
  68.  */
  69. {
  70.   install_struct, file, "char",    1, 1, -1;
  71.   install_struct, file, "short",   2, 2, -1;
  72.   install_struct, file, "int",     4, 4, -1;
  73.   install_struct, file, "long",    4, 4, -1;
  74.   install_struct, file, "float",   4, 4, -1, [0, 1, 8,  9,23, 0,  0x7f];
  75.   install_struct, file, "double",  8, 8, -1, [0, 1,11, 12,52, 0, 0x3ff];
  76.   struct_align, file, 1;
  77. }
  78.  
  79. func raw_alpha_p(file)
  80. /* DOCUMENT raw_alpha_p, file
  81.      sets FILE primitive data types to be native to DEC alpha workstations.
  82.  */
  83. {
  84.   install_struct, file, "char",    1, 1, -1;
  85.   install_struct, file, "short",   2, 2, -1;
  86.   install_struct, file, "int",     4, 4, -1;
  87.   install_struct, file, "long",    8, 8, -1;
  88.   install_struct, file, "float",   4, 4, -1, [0, 1, 8,  9,23, 0,  0x7f];
  89.   install_struct, file, "double",  8, 8, -1, [0, 1,11, 12,52, 0, 0x3ff];
  90.   struct_align, file, 1;
  91. }
  92.  
  93. func raw_cray_p(file)
  94. /* DOCUMENT raw_cray_p, file
  95.      sets FILE primitive data types to be native to Cray 1, XMP, and YMP.
  96.  */
  97. {
  98.   install_struct, file, "char",    1, 1, 1;
  99.   install_struct, file, "short",   8, 8, 1;
  100.   install_struct, file, "int",     8, 8, 1;
  101.   install_struct, file, "long",    8, 8, 1;
  102.   install_struct, file, "float",   8, 8, 1, [0, 1,15, 16,48, 1, 0x4000];
  103.   install_struct, file, "double",  8, 8, 1, [0, 1,15, 16,48, 1, 0x4000];
  104.   struct_align, file, 8;
  105. }
  106.  
  107. func raw_mac_p(file)
  108. /* DOCUMENT raw_mac_p, file
  109.      sets FILE primitive data types to be native to MacIntosh, 8 byte double.
  110.  */
  111. {
  112.   install_struct, file, "char",    1, 1, 1;
  113.   install_struct, file, "short",   2, 2, 1;
  114.   install_struct, file, "int",     2, 2, 1; /* some compilers 4 byte int */
  115.   install_struct, file, "long",    4, 2, 1;
  116.   install_struct, file, "float",   4, 2, 1, [0, 1, 8,  9,23, 0,  0x7f];
  117.   install_struct, file, "double",  8, 2, 1, [0, 1,11, 12,52, 0, 0x3ff];
  118.   struct_align, file, 1;
  119. }
  120.  
  121. func raw_macl_p(file)
  122. /* DOCUMENT raw_macl_p, file
  123.      sets FILE primitive data types to be native to MacIntosh, long double.
  124.  */
  125. {
  126.   install_struct, file, "char",    1, 1, 1;
  127.   install_struct, file, "short",   2, 2, 1;
  128.   install_struct, file, "int",     2, 2, 1; /* some compilers 4 byte int */
  129.   install_struct, file, "long",    4, 2, 1;
  130.   install_struct, file, "float",   4, 2, 1, [0, 1, 8,  9,23, 0,   0x7f];
  131.   install_struct, file, "double", 12, 2, 1, [0, 1,15, 32,64, 1, 0x3ffe];
  132.   struct_align, file, 1;
  133. }
  134.  
  135. func raw_pc_p(file)
  136. /* DOCUMENT raw_pc_p, file
  137.      sets FILE primitive data types to be native to IBM PC.
  138.  */
  139. {
  140.   install_struct, file, "char",    1, 1, -1;
  141.   install_struct, file, "short",   2, 2, -1;
  142.   install_struct, file, "int",     2, 2, -1;  /* XENIX uses 4 byte int */
  143.   install_struct, file, "long",    4, 2, -1;
  144.   install_struct, file, "float",   4, 2, -1, [0, 1, 8,  9,23, 0,  0x7f];
  145.   install_struct, file, "double",  8, 2, -1, [0, 1,11, 12,52, 0, 0x3ff];
  146.   struct_align, file, 1;
  147. }
  148.  
  149. func raw_vax_p(file)
  150. /* DOCUMENT raw_vax_p, file
  151.      sets FILE primitive data types to be native to VAXen, H-double, only.
  152.  */
  153. {
  154.   install_struct, file, "char",    1, 1, -1;
  155.   install_struct, file, "short",   2, 1, -1;
  156.   install_struct, file, "int",     4, 1, -1;
  157.   install_struct, file, "long",    4, 1, -1;
  158.   install_struct, file, "float",   4, 1, 2, [0, 1, 8,  9,23, 0,  0x81];
  159.   install_struct, file, "double",  8, 1, 2, [0, 1, 8,  9,55, 0,  0x81];
  160.   struct_align, file, 1;
  161. }
  162.  
  163. func raw_vaxg_p(file)
  164. /* DOCUMENT raw_vaxg_p, file
  165.      sets FILE primitive data types to be native to VAXen, G-double, only.
  166.  */
  167. {
  168.   install_struct, file, "char",    1, 1, -1;
  169.   install_struct, file, "short",   2, 1, -1;
  170.   install_struct, file, "int",     4, 1, -1;
  171.   install_struct, file, "long",    4, 1, -1;
  172.   install_struct, file, "float",   4, 1, 2, [0, 1, 8,  9,23, 0,  0x81];
  173.   install_struct, file, "double",  8, 1, 2, [0, 1,11, 12,52, 0, 0x401];
  174.   struct_align, file, 1;
  175. }
  176.  
  177. func raw_xdr_p(file)
  178. /* DOCUMENT raw_xdr_p, file
  179.      sets FILE primitive data types to be XDR (external data representation).
  180.  */
  181. {
  182.   install_struct, file, "char",    1, 1, 1;
  183.   install_struct, file, "short",   2, 2, 1;
  184.   install_struct, file, "int",     4, 4, 1;
  185.   install_struct, file, "long",    4, 4, 1;
  186.   install_struct, file, "float",   4, 4, 1, [0, 1, 8,  9,23, 0,  0x7f];
  187.   install_struct, file, "double",  8, 8, 1, [0, 1,11, 12,52, 0, 0x3ff];
  188.   struct_align, file, 1;
  189. }
  190.  
  191. /*--------------------------------------------------------------------------*/
  192.